home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / font_kit.zip / MAKEOBJ.BAS < prev   
BASIC Source File  |  1993-02-03  |  3KB  |  95 lines

  1. $compile exe
  2. $lib graph-,com-,lpt-,iprint+
  3. $STRING 8
  4. ' This program will convert 8x16 bit mapped font files to linkable ASM
  5. ' files with a subroutine bearing the same name as the original font file.
  6. ' if TASM or MASM exists in the current directory, this program will also
  7. ' shell to it and create the OBJ which you can link.  Command line or
  8. ' prompted file can contain wildcards to create OBJs from an entire
  9. ' directory of font files.
  10.  
  11.  
  12. if command$="" then input "Enter font filename: ",F$ else F$=Command$
  13. if f$="" then end
  14. f$=dir$(f$)
  15. if f$="" then print "File does not exist.":end
  16. dim f$(500)
  17. x=1
  18. f$(1)=f$
  19. do
  20.     incr x
  21.     f$(x)=dir$
  22. loop while len(f$(x))
  23.  
  24. for y=1 to x-1
  25.     call makeasm(f$(y))
  26.  
  27.  
  28. next y
  29.  
  30. end
  31.  
  32. sub makeasm(f$)
  33.     open f$ for binary as #1
  34.     get$ 1, lof(1), a$
  35.     close #1
  36.     if instr(f$,".")=0 then f$=f$+"."
  37.     p$=left$(f$,instr(f$,".")-1)
  38.         F2$=p$ + ".ASM"
  39.  
  40.     open f2$ for output as #1
  41.  
  42. PRINT #1, p$ + "SEG" + chr$(9,9) + "segment byte public"
  43. PRINT #1, "                assume  cs:"+p$+"SEG, ds:"+p$+"SEG"
  44. PRINT #1, ""
  45. PRINT #1, p$ + chr$(9,9) + "proc    far"
  46. PRINT #1, "                public  " + p$
  47. PRINT #1, ""
  48. PRINT #1, "start:"
  49. PRINT #1, "                push    bp"
  50. PRINT #1, "                push    es"
  51. PRINT #1, "                push    cs"
  52. PRINT #1, "                pop     es"
  53. PRINT #1, "                mov     ax, word ptr font"
  54. PRINT #1, "                push    ax"
  55. PRINT #1, "                pop     bp"
  56. PRINT #1, "                ADD     bp,31"
  57. PRINT #1, "                mov     ax,1100h"
  58. PRINT #1, "                mov     bh,16"
  59. PRINT #1, "                mov     bl,0"
  60. PRINT #1, "                mov     cx,0FFh"
  61. PRINT #1, "                mov     dx,0"
  62. PRINT #1, "                int     10h"
  63. PRINT #1, "                pop     es"
  64. PRINT #1, "                pop     bp"
  65. PRINT #1, "                retf"
  66. PRINT #1, ""
  67. PRINT #1, "font";
  68.  
  69.  
  70. for y=1 to len(a$) \ 16
  71.     b$=mid$(a$,(y*16)-15,16)
  72.     c$="        db      "
  73.     for x=1 to 15
  74.         c$=c$+str$(ascii(mid$(b$,x,1))) + ","
  75.     next x
  76.     c$=c$+str$(ascii(right$(b$,1)))
  77.     print #1, c$;
  78.     IF y > 32 and y<255 THEN PRINT #1, " ; chr " + str$(y-1) + " - " + CHR$(y-1) else print #1, ""
  79. next y
  80.  
  81. print #1, ""
  82. print #1, p$ + chr$(9,9) + "endp"
  83. print #1,""
  84. print #1,p$ + "SEG" + chr$(9,9) + "ends"
  85. print #1, ""
  86. print #1,"                end"
  87.  
  88. close #1
  89. PRINT "Created " + F2$ + " with proc " + p$
  90.  
  91.     if len(dir$("TASM.EXE")) THEN SHELL "TASM " + F2$
  92.     if len(dir$("MASM.EXE")) THEN SHELL "MASM " + F2$
  93.  
  94. END SUB
  95.